home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / winexit / winexit.bas < prev    next >
BASIC Source File  |  1994-08-26  |  2KB  |  48 lines

  1. Option Explicit
  2.  
  3. Declare Function ExitWindows Lib "User" (ByVal dwReturnCode As Long, ByVal reserved As Integer) As Integer
  4.  
  5. Global Const EW_REBOOTSYSTEM = &H43
  6. Global Const EW_RESTARTWINDOWS = &H42
  7. Global Const EW_EXITWINDOWS = &H0
  8.  
  9. Sub CentreForm (F As Form)
  10.  
  11.     F.Left = (screen.Width - F.Width) / 2
  12.     F.Top = (screen.Height - F.Height) / 2
  13.  
  14. End Sub
  15.  
  16. Sub MakeForm3D (frm As Form)
  17.  
  18. Dim tppy As Integer
  19. Dim tppx As Integer
  20.  
  21.     tppy = screen.TwipsPerPixelY
  22.     tppx = screen.TwipsPerPixelX
  23.  
  24.     frm.Line (frm.ScaleLeft, frm.ScaleTop)-(frm.ScaleLeft + frm.ScaleWidth, frm.ScaleTop), RGB(0, 0, 0)
  25.     frm.Line (frm.ScaleLeft + tppx, frm.ScaleTop + tppy)-(frm.ScaleLeft + frm.ScaleWidth - tppx, frm.ScaleTop + tppy), RGB(255, 255, 255)
  26.  
  27.     frm.Line (frm.ScaleLeft, frm.ScaleTop)-(frm.ScaleLeft, frm.ScaleTop + frm.ScaleHeight - tppy), RGB(0, 0, 0)
  28.     frm.Line (frm.ScaleLeft + tppx, frm.ScaleTop + tppy)-(frm.ScaleLeft + tppx, frm.ScaleTop + frm.ScaleHeight - 2 * tppy), RGB(255, 255, 255)
  29.  
  30.     frm.Line (frm.ScaleLeft, frm.ScaleTop + frm.ScaleHeight - tppy)-(frm.ScaleLeft + frm.ScaleWidth, frm.ScaleTop + frm.ScaleHeight - tppy), RGB(0, 0, 0)
  31.     frm.Line (frm.ScaleLeft + tppx, frm.ScaleTop + frm.ScaleHeight - 2 * tppy)-(frm.ScaleLeft + frm.ScaleWidth - 2 * tppx, frm.ScaleTop + frm.ScaleHeight - 2 * tppy), RGB(128, 128, 128)
  32.  
  33.     frm.Line (frm.ScaleLeft + frm.ScaleWidth - tppx, frm.ScaleTop)-(frm.ScaleLeft + frm.ScaleWidth - tppx, frm.ScaleTop + frm.ScaleHeight - tppy), RGB(0, 0, 0)
  34.     frm.Line (frm.ScaleLeft + frm.ScaleWidth - 2 * tppx, frm.ScaleTop + 2 * tppy)-(frm.ScaleLeft + frm.ScaleWidth - 2 * tppx, frm.ScaleTop + frm.ScaleHeight - tppy), RGB(128, 128, 128)
  35.  
  36. End Sub
  37.  
  38. Sub WinExit (Choice As Integer)
  39.     
  40. Dim RetCode As Integer
  41. Dim ActionCode As Long
  42.  
  43.     ActionCode = Choose(Choice + 1, EW_EXITWINDOWS, EW_RESTARTWINDOWS, EW_REBOOTSYSTEM)
  44.     RetCode = ExitWindows(ActionCode, 0)
  45.  
  46. End Sub
  47.  
  48.